package com.qk.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qk.common.PageResult;
import com.qk.dto.CustomerDto;
import com.qk.entity.Customer;
import com.qk.mapper.CustomerMapper;
import com.qk.service.CustomerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {

    @Autowired
    private CustomerMapper customerMapper;

    //分页查询
    @Override
    public PageResult<Customer> listCustomers(CustomerDto customerDto) {
       Page<Customer> page = customerMapper.listCustomers(new Page<Customer>(customerDto.getPage(),customerDto.getPageSize()),customerDto);
        return new PageResult<Customer>(page.getTotal(),page.getRecords());
    }


}
